package servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.userBean;
import bean.weiboBean;
import pojo.Weibo;
import pojo.user;

/**
 * Servlet implementation class indexsvl
 */
@WebServlet("/userlistsvl")
public class userlistsvl extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public userlistsvl() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {request.setCharacterEncoding("utf-8");
		HttpSession session =request.getSession(false);
		user a = new user();
		userBean ub = new userBean();
		ArrayList list = new ArrayList();
		//ArrayList forwordlist = new ArrayList();
		list = ub.selectUserList();	
		System.out.println("list.size"+list.size());
		request.setAttribute("table", list);	
//		if(session != null){
//			//wb = (Weibo) list.get(0);
//			//forwordlist = wbb.selectForwordWeibo(wb.getWeiboid());
//			//System.out.println(wb.getWeiboid());
//			Object iid = session.getAttribute("userId");
//			if(iid!=null){
//				 userid = (int)iid;
//			}	
//			ArrayList focusList = new ArrayList();
//			focusList = wbb.selectFocus(userid);
//			request.setAttribute("table", focusList);
//			
//		}	
		request.getRequestDispatcher("userlist.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
